package com.cec.controller.admin;


import com.cec.service.admin.VolunteerService;
import com.cec.dto.VolunteerDTO;
import com.cec.result.Result;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lt
 * @since 2024-10-25
 */
@Slf4j
@RestController
@RequestMapping("/admin/volunteer")
public class VolunteerController {
    @Autowired
    private VolunteerService volunteerService;
    @GetMapping
    @ApiOperation("报名活动")
    public Result pageQueryVolunteerActivityReg(VolunteerDTO volunteerDTO){
        log.info("volunteerDTO-->{}",volunteerDTO);
        return volunteerService.pageQueryVolunteerActivityReg(volunteerDTO);
    }

    @DeleteMapping("/logicDel/{id}")
    @ApiOperation("逻辑删除志愿者信息")
    public Result logicDeleteVolunteerActivityRegById(@PathVariable Integer id){
        log.info("id-->{}",id);
        return volunteerService.logicDeleteVolunteerActivityRegById(id);
    }

    @DeleteMapping("/logicBatchDel")
    @ApiOperation("逻辑批量删除志愿者信息")
    public Result logicBatchDeleteVolunteerActivityRegByIds(@RequestBody List<Integer> ids){
        log.info("id-->{}",ids);
        return volunteerService.logicBatchDeleteVolunteerActivityRegByIds(ids);
    }

    @ApiOperation("志愿者管理")
    @PutMapping
    public Result updateVolunteerActivityReg(@RequestBody VolunteerDTO volunteerDTO){
        return volunteerService.updateVolunteerActivityReg(volunteerDTO);
    }
}

